package cn.tk.model.entity.mr;

import cn.tk.model.entity.AbstractEntity;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Objects;

/**
 * Created by denglw on 2021/7/16.<br/>
 * Desc: 流程片段
 */
@Data @NoArgsConstructor
@Entity(name = "mrFlow")
@Table(name = "mr_bot_flow")
public class Flow extends AbstractEntity {

    /**
     * botid
     */
    private Long botId;

    /**
     * 名称
     */
    private String name;

    /**
     * 是否主流程：0否 1是
     */
    private Boolean ifPrimary;

    /**
     * 是否自动跳回：0否 1是
     */
    private Boolean jumpable;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof Flow)) {
            return false;
        }
        Flow flow = (Flow) o;
        return Objects.equals(flow.getId(), getId())
                && Objects.equals(botId, flow.botId)
                && Objects.equals(name, flow.name)
                && Objects.equals(ifPrimary, flow.ifPrimary)
                && Objects.equals(jumpable, flow.jumpable);
    }

    @Override
    public int hashCode() {
        return Objects.hash(getId(), botId, name, ifPrimary, jumpable);
    }
}
